<template>
<input type="text" placeholder="输入货物名称" v-model="queryStr" >
	</template>
	<script>

const debounce = (function() {
    let timer = 0;
    return function(func, delay) {
      clearTimeout(timer);
      timer = setTimeout(func, delay);
    };
})();
		export default {
	
data(){
   return {
     queryStr: '',
     results:[]
   }
},
	watch: {
    queryStr() {
      debounce(() => {
        this.search();
      }, 200);
    },
},
methods:{
    search(){
        let that = this;
				uni.request({
				url: 'https://api.xuejss.com/xue/?s=muban.muban_list&keyword='+that.queryStr,
				method: 'GET',
				data: {},
					success: res => {
						//console.log(res);
						var newsList = res.data.data.mblist;
						this.mubanList = this.mubanList.concat(newsList);

                        uni.hideLoading();
						page++;
					},
					complete: res => {
						uni.hideLoading();
						uni.stopPullDownRefresh();
					}
				}); 
    }
}
		};
	</script> 

